﻿package mortal.game.view.platform.platformTencent
{
    import com.mui.controls.*;
    import extend.language.*;
    import fl.controls.*;
    import flash.events.*;
    import mortal.component.gconst.*;
    import mortal.game.manager.*;
    import mortal.game.resource.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;

    public class PlatformTencentBasePanel extends GSprite
    {
        protected var _bg:GImageBitmap;
        protected var _xufeiBtn:GLoadingButton;
        protected var _xufeiYearBtn:GLoadingButton;
        protected var _moreTipBtn:GButton;

        public function PlatformTencentBasePanel()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._bg = UIFactory.gImageBitmap("", 1, 2, this);
            if (PlatformTencentUtil.isYellowEnter())
            {
                this.createYellow();
            }
            else if (PlatformTencentUtil.isBlueEnter())
            {
                this.createBlue();
            }
            return;
        }// end function

        protected function createYellow() : void
        {
            this._xufeiBtn = UIFactory.gLoadingButton(ResFileConst.QQYellowXufeiBtn, 20 + 100 + 27, 400 + 10, 110, 34, this);
            this._xufeiYearBtn = UIFactory.gLoadingButton(ResFileConst.QQYellowYearXufeiBtn, 20 + 200 + 73, 400 + 10, 139, 34, this);
            this._xufeiBtn.configEventListener(MouseEvent.CLICK, this.onLinkClick);
            this._xufeiYearBtn.configEventListener(MouseEvent.CLICK, this.onLinkClick);
            return;
        }// end function

        protected function createBlue() : void
        {
            this._xufeiBtn = UIFactory.gLoadingButton(ResFileConst.QQBlueKaiTongBtn, 20 + 100, 400 - 2 + 10, 130, 37, this);
            this._xufeiYearBtn = UIFactory.gLoadingButton(ResFileConst.QQBlueYearKaitongBtn, 20 + 200 + 53, 400 - 2 + 10, 159, 37, this);
            this._xufeiBtn.configEventListener(MouseEvent.CLICK, this.onLinkClick);
            this._xufeiYearBtn.configEventListener(MouseEvent.CLICK, this.onLinkClick);
            this._moreTipBtn = UIFactory.gButton(Language.getStringByParam(90482, Language.getString(90484)), 200 - 124, 500 - 48, 400, 22, this, "GreenLinkButton");
            this._moreTipBtn.configEventListener(MouseEvent.CLICK, this.onLinkClick);
            return;
        }// end function

        private function onLinkClick(event:MouseEvent) : void
        {
            if (event.target == this._xufeiBtn)
            {
                GameUtil.gotoQQVipMonthUpgrade();
            }
            else if (event.target == this._xufeiYearBtn)
            {
                GameUtil.gotoQQVipYearUpgrade();
            }
            else if (event.target == this._moreTipBtn)
            {
                GameUtil.gotoQQVipGuanwang();
            }
            return;
        }// end function

        protected function setBtnCanGetStyle(param1:Button) : void
        {
            if (!param1)
            {
                return;
            }
            param1.mouseEnabled = true;
            param1.filters = [];
            EffectManager.glowFilterReg(param1);
            return;
        }// end function

        protected function setBtnCanNotGetStyle(param1:Button) : void
        {
            if (!param1)
            {
                return;
            }
            param1.mouseEnabled = false;
            EffectManager.glowFilterUnReg(param1);
            param1.filters = [FilterConst.colorFilter3];
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._bg.dispose(param1);
            this._bg = null;
            if (this._xufeiBtn)
            {
                this._xufeiBtn.dispose(param1);
                this._xufeiBtn = null;
            }
            if (this._xufeiYearBtn)
            {
                this._xufeiYearBtn.dispose(param1);
                this._xufeiYearBtn = null;
            }
            if (this._moreTipBtn)
            {
                this._moreTipBtn.dispose(param1);
                this._moreTipBtn = null;
            }
            super.disposeImpl(param1);
            return;
        }// end function

        public function refresh() : void
        {
            return;
        }// end function

    }
}
